#ifndef DB_H_25012012
#define DB_H_25012012

#include <string>
#include <map>

#include "exception.hpp"
#include "student.h"

class DataBase
{
public:
	DataBase( const std::string& sFilePath ) throw( utils::Exception );
	~DataBase();
public:
	void Reload() throw( utils::Exception );
	Student* Search( int nFN ) throw( utils::Exception );
	Student* Search( std::string sFN ) throw( utils::Exception );
	std::string GetFilePath();
	std::string GetAvailableFNsPrintable();

private:
	typedef std::map < unsigned int, Student* > StudentMap;
	pthread_mutex_t mxDatabase;
	StudentMap m_mapStudents;
	void Clear();
	std::string m_sFilePath;
	time_t m_tLastWriteTime;

};

#endif
